package pro.cherish.smartfile.common.exception;

import pro.cherish.smartfile.common.enums.BaseEnum;

import java.io.Serializable;

/**
 * @author lys
 */
public class CommonException extends RuntimeException {
    private static final long serialVersionUID = -22770741532405155L;
    private Serializable code = 500;

    public CommonException(String message) {
        super(message);
    }

    public CommonException(String message, Serializable code) {
        super(message);
        this.code = code;
    }

    public CommonException(Throwable cause) {
        super(cause);
    }

    public CommonException(String message, Throwable cause) {
        super(message, cause);
    }

    public CommonException(BaseEnum baseEnum) {
        super(baseEnum.getDesc());
        this.code = baseEnum.getCode();
    }

    public Serializable getCode() {
        return this.code;
    }

    public void setCode(final Serializable code) {
        this.code = code;
    }
}